package com.ke.jdyd.util;

import android.content.Context;
import android.content.SharedPreferences;

import static android.content.Context.MODE_PRIVATE;

public class SPManager {
    private  static final  String SP_NAME = "4399";
    public static void updateUserLogin(Context context,String token){
        SharedPreferences sharedPreferences = context.getSharedPreferences(SP_NAME, MODE_PRIVATE);
        SharedPreferences.Editor edit = sharedPreferences.edit();
        edit.putString("user_token", token);
        edit.apply();
    }
    public static void updateUserInfo(Context context,String id){
        SharedPreferences sharedPreferences = context.getSharedPreferences(SP_NAME, MODE_PRIVATE);
        SharedPreferences.Editor edit = sharedPreferences.edit();
        edit.putString("user_id", id);
        edit.apply();
    }

    /**
     * 获取用户token
     * @param context
     */
    public static String getUserToken(Context context){
        SharedPreferences preferences = context.getSharedPreferences(SP_NAME, MODE_PRIVATE);
        return preferences.getString("user_token", "");
    }

}
